home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 March: Reference Library / Dev.CD Mar 96 RL / Dev.CD Mar 96 RL.toast / Technical Documentation / develop / develop Issue 25 / develop Issue 25 code / C++ exceptions in C / UException.cp < prev    next >
Encoding:
Text File  |  1995-08-30  |  1.4 KB  |  42 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    UException.cp                    ©1995 Metrowerks Inc. All rights reserved.
  3. // ===========================================================================
  4. //
  5. //    The C++ draft standard states that the Exception Handling mechanism
  6. //    call terminate() when encountering certain unrecoverable errors,
  7. //    such as:
  8. //        - Not finding a handler for a thrown exception
  9. //        - Finding a corrupted stack
  10. //        - A destructor called during stack unwinding tries to exit
  11. //            using an exception
  12. //
  13. //    The default implementation of terminate() calls abort().
  14. //
  15. //    abort() is a standard ANSI C library function. Since PowerPlant
  16. //    programs frequently don't include the ANSI C library, the abort()
  17. //    function is defined below.
  18. //
  19. //    Do NOT include this file in your project if you use the ANSI C library.
  20. //    If you use the ANSI C Library, include the file console.stubs.c (in the
  21. //    folder with the SIOUX libraries) in your project instead of UException.cp.
  22.  
  23. #include <UDebugging.h>
  24.  
  25.  
  26. #ifndef __SEGLOAD__
  27. #include <SegLoad.h>
  28. #endif
  29.  
  30.  
  31. // ---------------------------------------------------------------------------
  32. //        • abort
  33. // ---------------------------------------------------------------------------
  34. //    Terminate a program
  35.  
  36. extern "C" void abort(void);
  37. void abort(void)
  38. {
  39.     SignalPStr_("\pAborting Program. Probably a throw without a matching catch.");
  40.     ::ExitToShell();
  41. }
  42.